﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for clsProductsList
/// </summary>
public class clsProductsList
{
    #region MEMBER VARIABLES

    protected DataSet m_dtsProducts;
    protected DataView m_dtvProducts;

    clsUser m_clsUser;

    #endregion

    #region PROPERTIES

    public String FilterExpression
    {
        get
        {
            return m_dtvProducts.RowFilter;
        }
        set
        {
            m_dtvProducts.RowFilter = value;
        }
    }

    public String SortExpression
    {
        get
        {
            return m_dtvProducts.Sort;
        }
        set
        {
            m_dtvProducts.Sort = value;
        }
    }

    #endregion

    #region CONSTRUCTORS

    public clsProductsList(clsUser clsUser)
    {
        m_clsUser = clsUser;
        Initialise();
    }

    #endregion

    #region PUBLIC METHODS

    public DataView GetRecords()
    {
        return m_dtvProducts;
    }

    #endregion

    #region PROTECTED METHODS

    protected void Initialise()
    {
        try
        {
            m_dtsProducts = DataConnection.GetDataObject().GetData("Data", "spProductsList");
            m_dtvProducts = m_dtsProducts.Tables[0].DefaultView;
        }
        catch (Exception ex)
        {
            clsErrorLog.LogError(ex, this, m_clsUser, 95);
            throw ex;
        }
    }

    #endregion
}
